<template>
	<view class="clearfix">
		<view class="list">
			<view class="item" v-for="item in bankList" :key="item.id" @click="toRevCard(item)">
				<view class="img_wrap">
					<image class="img" :src="item.backUrl" mode="aspectFill"></image>
				</view>
				<view class="con">
					<view class="top">
						<view class="l">
							<image class="img" :src="item.logUrl" mode="aspectFill"></image>
						</view>
						<view class="r">
							<view class="typeName">{{item.bankName}}</view>
							<view>储蓄银行卡</view>
						</view>
					</view>
					<view class="bankNum">{{item.bankNum}}</view>
				</view>
			</view>
		</view>
		<button class="addBank" @click="toAddCard">
			<text class="uniicons">&#xe468;</text>
			<text>添加银行卡</text>
		</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				bankList: []
			};
		},
		onShow() {
			this.getBaknList();
		},
		methods:{
			//查看银行卡详情
			toRevCard(obj) {
				 var params = JSON.stringify(obj)
				uni.navigateTo({
					url:'/pages/bank/revBankCard?obj='+params
				})
				//this.$Router.push({ name: 'revBankCard', params: obj})
				// this.$Router.push({
				//     path:"/pages/bank/revBankCard",
				//     query:{
				//         status:true,
				//         obj:obj
				//     }
				// })
			},
			//获取银行卡列表
			getBaknList() {
				this.$api.getBankList().then(res=> {
					this.bankList = res.data.data;
				})
			},
			//添加银行卡
			toAddCard(){
				uni.navigateTo({
					url:"/pages/bank/bankNewCard"
				})
			}
		}
	}
</script>
<style>
	page{background: #F8F8F8;padding: 0 30rpx;box-sizing: border-box;}
</style>
<style lang="scss" scoped>
	.addBank{height: 140rpx;background: #fff;border-radius:20rpx;display: flex;align-items: center;margin: 20rpx auto 50rpx;padding: 40rpx;
		font-size: 32rpx;width: 690rpx;
		.uniicons{font-size: 40rpx;margin-right: 30rpx;}
	}
	.addBank::after{border: unset;}
	.item{ height: 228rpx;position: relative;margin: 20rpx auto 0;color: white;width: 690rpx;
		.img_wrap{position: absolute;left: 0;top: 0;}
		.img_wrap,.img{width: 100%;height: 100%;}
		.con{position: relative;z-index: 99;
			.top{ display: flex;align-items: center;justify-content: space-between;padding-top: 40rpx;
				.l{width: 60rpx;height: 60rpx;margin:  0 40rpx ;}
				.r{flex: 1;}
			}
			.typeName{font-size: 32rpx;font-weight: bold;}
			.bankNum{margin-top: 30rpx;padding-left: 140rpx;}
		}
	}
</style>
